package my.suveng.oauth2.model.struct;

import my.suveng.oauth2.model.dto.RoleAddDto;
import my.suveng.oauth2.service.db.mysql.model.entity.SysRole;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface SysRoleStructMapper {

    SysRoleStructMapper INSTANCE = Mappers.getMapper(SysRoleStructMapper.class);

    /**
     * dto -> entity
     * 
     * @author suwenguang
     */
    @Mappings({ @Mapping(target = "name", source = "name"), @Mapping(target = "createTime", ignore = true),
            @Mapping(target = "creator", ignore = true), @Mapping(target = "id", ignore = true),
            @Mapping(target = "modifyTime", ignore = true), @Mapping(target = "status", ignore = true),
            @Mapping(target = "updator", ignore = true) })
    SysRole dto2entity(RoleAddDto dto);

    List<SysRole> dtos2entitys(List<RoleAddDto> dtos);

}
